from pymongo import MongoClient
import pandas as pd
client = MongoClient(port=27017)
db=client['tiktok']

for col in db.list_collection_names()[:60]:
#for col in ['rnbvibes','']:
# collist=['2018vs2021']
# for col in collist:
    t=0
    img=0
    text=0
    yam=0
    label=0
    v=0
    v1=0
    v2=0
    for obj in db[col].find():
        t+=1

        if not (len(obj['video_feature']['img_embed']) > 0):
            img+=1
        if not (len(obj['text_feature']['text'])>0 ):
            text+=1
        if not (len(obj['video_feature']['audio']['yamnet'])>0 ):
            yam+=1
        if not ((len(obj['video_feature']['label'])>0)and (len(obj['video_feature']['residual'])>0) and('labelA_n' in obj['video_feature']['label'].keys())) :
            label+=1
        if not('var_sb' in obj['video_feature']['editing'].keys()) :
            v+=1
        if not('avg_sticker_length' in obj['video_feature']['editing'].keys()):
            v1+=1
        if not('avg_scences' in obj['video_feature']['editing'].keys()):
            v2+=1
    print(col)
    print('img pct:',img,t,img/t)
    print('text pct:', text, t, text / t)
    print('yamnet pct:', yam, t, yam / t)
    print('label pct:', label, t, label / t)
    print('var sb pct:', v, t, v / t)
    print('avg sticker len pct:', v1, t, v1 / t)
    print('avg scence pct:', v2, t, v2 / t)
